// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.ai.states;

import zombie.ai.State;
import zombie.characters.IsoGameCharacter;
import zombie.characters.IsoZombie;
import zombie.core.Core;
import zombie.iso.objects.IsoDeadBody;
import zombie.network.GameClient;

public final class FakeDeadZombieState extends State {
    private static final FakeDeadZombieState _instance = new FakeDeadZombieState();

    public static FakeDeadZombieState instance() {
        return _instance;
    }

    @Override
    public void enter(IsoGameCharacter owner) {
        owner.setVisibleToNPCs(false);
        owner.setCollidable(false);
        ((IsoZombie)owner).setFakeDead(true);
        owner.setOnFloor(true);
    }

    @Override
    public void execute(IsoGameCharacter owner) {
        if (owner.isDead()) {
            if (GameClient.bClient && owner instanceof IsoZombie) {
                GameClient.sendZombieDeath((IsoZombie)owner);
            }

            if (!GameClient.bClient) {
                new IsoDeadBody(owner);
            }
        } else if (Core.bLastStand) {
            ((IsoZombie)owner).setFakeDead(false);
        }
    }

    @Override
    public void exit(IsoGameCharacter owner) {
        ((IsoZombie)owner).setFakeDead(false);
    }
}
